#include<stdio.h>

#define BASEMONEY 10.00

int main(){

    double time;
    double total,tax,income;
    char choose;

    do{

        printf("please input the work hourse one week:\n");
        scanf("%lf",&time);


        // if(time<=40){
        //     total=BASEMONEY*time;
        //     if(total<=300){
        //         tax=0.15*total;   
        //     }
        //     else if(300<total<=450){
        //         tax=0.15*300+0.2*(total-300);   
        //     }
        //     else{
        //         tax=0.15*300+0.2*150+0.25*(total-450);
        //     }
        // }
        // else{  //time>40
        //     total=BASEMONEY*1.5*time;
        //     if(total<=300){
        //         tax=0.15*total;   
        //     }
        //     else if(300<total<=450){
        //         tax=0.15*300+0.2*(total-300);   
        //     }
        //     else{
        //         tax=0.15*300+0.2*150+0.25*(total-450);
        //     }
        // }//优化，用两个if语句写

        if(time<=40){
            total=BASEMONEY*time;
        }
        else{
            total=BASEMONEY*1.5*time;
        }

        if(total<=300){
            tax=0.15*total;   
        }
        else if(300<total<=450){
            tax=0.15*300+0.2*(total-300);   
        }
        else{
            tax=0.15*300+0.2*150+0.25*(total-450);
        }


        income=total-tax;

        printf("the total money is %lf \n",total);
        printf("the tax is %lf \n",tax);
        printf("the income is %lf \n",income);
        printf("if you want to continue please enter'y':\n");
        scanf(" %c",&choose);

    }while(choose=='y');
}